package com.freedom.supercoin.network;

import android.app.Application;

import com.freedom.supercoin.base_library.listener.DataConfig;


/**
 * Created by zzq on 2018/4/3.
 */

public class DataManager {

    private static volatile DataManager ourInstance;
    private ApiService.NetService netService;
    private DataConfig dataConfig;

    private DataManager() {
    }

//    public Observable<Result<CoinInfoModel>> getCoinInfo(CoinInfoReq coinInfoReq) {
//        return marketService.getCoinInfo(coinInfoReq);
//    }


    public static DataManager getInstance() {
        if (ourInstance == null) {
            synchronized (DataManager.class) {
                if (ourInstance == null) {
                    ourInstance = new DataManager();
                }
            }
        }
        return ourInstance;
    }

    /**
     * 初始化网络请求
     *
     * @param appContext
     * @param dataConfig
     */
    public void init(Application appContext, DataConfig dataConfig) {
        if (dataConfig == null) {
            throw new RuntimeException("Data Config can not be NULL");
        }
        this.dataConfig = dataConfig;
        ApiService apiService = new ApiService(dataConfig.getBaseUrl());
        this.netService = apiService.getNetService();
    }



}
